<?php
include('HTGPage.class.php');

$page = new HTGPage();

/* @var $utils Utils */
$utils = $page->myUtils;

/* @var $security HTSecurity */
$security = $page->mySecurity;

$authenticated = false;
if(isset($_REQUEST['login_email']) && isset($_REQUEST['login_password'])) {
	$myUsername = $_REQUEST['login_email'];
	$myPassword = $_REQUEST['login_password'];
	$loginSuccess = $page->login($myUsername, $myPassword);
	if(!($loginSuccess)) {
		$page->content .= '<span class="form_error">There was an error with your email and/or password. Please try again or contact us at halftimegenius@gmail.com </span>';
	}
	$authenticated = $page->isLoggedIn();
}

$page->preHeadCloseContent .= '<link href="login.css" type="text/css" rel="stylesheet" />';

if(!($authenticated)) {
	$page->content .= $utils->get_include_contents('login.html');
  $page->display();
} else {
	$page->redirectTo('home.php');
}


?>